/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * WarehousePnl.java
 *
 * Created on Jul 17, 2011, 9:24:42 AM
 */
package com.viweb.storemanager.ui.warehouse;

import com.viweb.storemanager.core.CursorManager;
import com.viweb.storemanager.ui.MainFrm;
import com.viweb.storemanager.ui.sale.SaleinvoicePnl;
import java.awt.Cursor;

/**
 *
 * @author qhvic
 */
public class WarehouseImportExportPnl extends javax.swing.JPanel {

    private MainFrm main;

    /** Creates new form WarehousePnl */
    public WarehouseImportExportPnl() {
        initComponents();
    }

    public WarehouseImportExportPnl(MainFrm main) {
        initComponents();
        this.main = main;
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
        java.awt.GridBagConstraints gridBagConstraints;

        btnGroupStatus = new javax.swing.ButtonGroup();
        sppGoods = new javax.swing.JSplitPane();
        pnlGoods = new javax.swing.JPanel();
        scpGoods = new javax.swing.JScrollPane();
        treeGoods = new javax.swing.JTree();
        pnlContainer = new javax.swing.JPanel();
        pnlList = new javax.swing.JPanel();
        lblName = new javax.swing.JLabel();
        lblNotes = new javax.swing.JLabel();
        lblDateModifier = new javax.swing.JLabel();
        txtName = new javax.swing.JTextField();
        lblEmpty = new javax.swing.JLabel();
        scpNotes = new javax.swing.JScrollPane();
        txtNotes = new javax.swing.JTextPane();
        btnSave = new javax.swing.JButton();
        lblDateModifierEdit = new javax.swing.JLabel();
        radioYes = new javax.swing.JRadioButton();
        lblStatus = new javax.swing.JLabel();
        radioNo = new javax.swing.JRadioButton();
        jPanel1 = new javax.swing.JPanel();
        btnImport = new javax.swing.JButton();
        btnExport = new javax.swing.JButton();
        scpImportExportList = new javax.swing.JScrollPane();
        tblImportExportList = new javax.swing.JTable();
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jButton3 = new javax.swing.JButton();

        setMinimumSize(new java.awt.Dimension(211, 99));
        setPreferredSize(new java.awt.Dimension(462, 478));
        setLayout(new java.awt.BorderLayout());

        pnlGoods.setMinimumSize(new java.awt.Dimension(90, 95));
        pnlGoods.setPreferredSize(new java.awt.Dimension(103, 394));
        pnlGoods.setLayout(new java.awt.GridBagLayout());

        treeGoods.setMaximumSize(new java.awt.Dimension(91, 64));
        treeGoods.setPreferredSize(new java.awt.Dimension(91, 64));
        scpGoods.setViewportView(treeGoods);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        pnlGoods.add(scpGoods, gridBagConstraints);

        sppGoods.setLeftComponent(pnlGoods);

        pnlContainer.setMinimumSize(new java.awt.Dimension(211, 99));
        pnlContainer.setPreferredSize(new java.awt.Dimension(462, 478));
        pnlContainer.setLayout(new java.awt.GridBagLayout());

        pnlList.setLayout(new java.awt.GridBagLayout());

        lblName.setText("Tên kho:");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 0, 0);
        pnlList.add(lblName, gridBagConstraints);

        lblNotes.setText("Ghi chú:");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 0, 0);
        pnlList.add(lblNotes, gridBagConstraints);

        lblDateModifier.setText("Ngày cập nhật:");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 0, 0);
        pnlList.add(lblDateModifier, gridBagConstraints);

        txtName.setEnabled(false);
        txtName.setMinimumSize(new java.awt.Dimension(200, 25));
        txtName.setPreferredSize(new java.awt.Dimension(200, 25));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.gridwidth = 3;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 0, 5);
        pnlList.add(txtName, gridBagConstraints);

        lblEmpty.setMinimumSize(new java.awt.Dimension(5, 50));
        lblEmpty.setPreferredSize(new java.awt.Dimension(5, 50));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.gridwidth = 3;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        pnlList.add(lblEmpty, gridBagConstraints);

        scpNotes.setViewportView(txtNotes);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.gridwidth = 3;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 0, 5);
        pnlList.add(scpNotes, gridBagConstraints);

        btnSave.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/viweb/storemanager/imgae/save.png"))); // NOI18N
        btnSave.setText("Lưu");
        btnSave.setToolTipText("Lưu thể loại vừa thêm mới hay hiệu chỉnh");
        btnSave.setEnabled(false);
        btnSave.setMaximumSize(new java.awt.Dimension(80, 26));
        btnSave.setMinimumSize(new java.awt.Dimension(80, 26));
        btnSave.setPreferredSize(new java.awt.Dimension(80, 26));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 3;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 0, 5);
        pnlList.add(btnSave, gridBagConstraints);

        lblDateModifierEdit.setEnabled(false);
        lblDateModifierEdit.setMaximumSize(new java.awt.Dimension(200, 14));
        lblDateModifierEdit.setMinimumSize(new java.awt.Dimension(200, 14));
        lblDateModifierEdit.setPreferredSize(new java.awt.Dimension(200, 14));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 0, 5);
        pnlList.add(lblDateModifierEdit, gridBagConstraints);

        btnGroupStatus.add(radioYes);
        radioYes.setText("Có");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 0, 5);
        pnlList.add(radioYes, gridBagConstraints);

        lblStatus.setText("Tình trạng:");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 0, 0);
        pnlList.add(lblStatus, gridBagConstraints);

        btnGroupStatus.add(radioNo);
        radioNo.setText("Không");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 2;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(5, 20, 0, 5);
        pnlList.add(radioNo, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(0, 5, 5, 5);
        pnlContainer.add(pnlList, gridBagConstraints);

        jPanel1.setLayout(new java.awt.GridBagLayout());

        btnImport.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/viweb/storemanager/imgae/import1.png"))); // NOI18N
        btnImport.setText("Nhập kho");
        btnImport.setMaximumSize(new java.awt.Dimension(98, 26));
        btnImport.setMinimumSize(new java.awt.Dimension(98, 26));
        btnImport.setPreferredSize(new java.awt.Dimension(98, 26));
        btnImport.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnImportActionPerformed(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 0, 5);
        jPanel1.add(btnImport, gridBagConstraints);

        btnExport.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/viweb/storemanager/imgae/export2.png"))); // NOI18N
        btnExport.setText("Xuất kho");
        btnExport.setMaximumSize(new java.awt.Dimension(98, 26));
        btnExport.setMinimumSize(new java.awt.Dimension(98, 26));
        btnExport.setPreferredSize(new java.awt.Dimension(98, 26));
        btnExport.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnExportActionPerformed(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 0, 5);
        jPanel1.add(btnExport, gridBagConstraints);

        scpImportExportList.setPreferredSize(new java.awt.Dimension(452, 402));

        tblImportExportList.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {

            }
        ));
        scpImportExportList.setViewportView(tblImportExportList);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.gridwidth = 3;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        jPanel1.add(scpImportExportList, gridBagConstraints);

        jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/viweb/storemanager/imgae/add.png"))); // NOI18N
        jButton1.setText("Thêm");
        jButton1.setMaximumSize(new java.awt.Dimension(80, 26));
        jButton1.setMinimumSize(new java.awt.Dimension(80, 26));
        jButton1.setPreferredSize(new java.awt.Dimension(80, 26));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
        gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 5);
        jPanel1.add(jButton1, gridBagConstraints);

        jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/viweb/storemanager/imgae/edit.png"))); // NOI18N
        jButton2.setText("Sửa");
        jButton2.setMaximumSize(new java.awt.Dimension(80, 26));
        jButton2.setMinimumSize(new java.awt.Dimension(80, 26));
        jButton2.setPreferredSize(new java.awt.Dimension(80, 26));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 5);
        jPanel1.add(jButton2, gridBagConstraints);

        jButton3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/viweb/storemanager/imgae/remove.png"))); // NOI18N
        jButton3.setText("Xóa");
        jButton3.setMaximumSize(new java.awt.Dimension(80, 26));
        jButton3.setMinimumSize(new java.awt.Dimension(80, 26));
        jButton3.setPreferredSize(new java.awt.Dimension(80, 26));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 2;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 5);
        jPanel1.add(jButton3, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        pnlContainer.add(jPanel1, gridBagConstraints);

        sppGoods.setRightComponent(pnlContainer);

        add(sppGoods, java.awt.BorderLayout.CENTER);
    }// </editor-fold>//GEN-END:initComponents

    private void btnImportActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnImportActionPerformed
        // TODO add your handling code here:
        main.setCursor(new Cursor(Cursor.WAIT_CURSOR));
        CursorManager.setWaitCursor(main);

        main.setCustomApplicationTitle("Khách hàng");

        main.pnlMainPane.removeAll();
        SaleinvoicePnl saleinvoicePnl = new SaleinvoicePnl();
        main.pnlMainPane.add(saleinvoicePnl);
        main.pnlMainPane.updateUI();

        main.pnlSecondPane.removeAll();
        main.pnlSecondPane.add(saleinvoicePnl.getCreationPanel());
        main.pnlSecondPane.updateUI();

        main.pnlRight.removeAll();
        main.pnlRight.add(main.pnlDualPane);
        main.pnlRight.updateUI();

        main.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
    }//GEN-LAST:event_btnImportActionPerformed

    private void btnExportActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExportActionPerformed
        // TODO add your handling code here:
        main.setCursor(new Cursor(Cursor.WAIT_CURSOR));
        CursorManager.setWaitCursor(main);

        main.setCustomApplicationTitle("Khách hàng");

        main.pnlMainPane.removeAll();
        SaleinvoicePnl saleinvoicePnl = new SaleinvoicePnl();
        main.pnlMainPane.add(saleinvoicePnl);
        main.pnlMainPane.updateUI();

        main.pnlSecondPane.removeAll();
        main.pnlSecondPane.add(saleinvoicePnl.getCreationPanel());
        main.pnlSecondPane.updateUI();

        main.pnlRight.removeAll();
        main.pnlRight.add(main.pnlDualPane);
        main.pnlRight.updateUI();

        main.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
    }//GEN-LAST:event_btnExportActionPerformed
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnExport;
    private javax.swing.ButtonGroup btnGroupStatus;
    private javax.swing.JButton btnImport;
    private javax.swing.JButton btnSave;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JLabel lblDateModifier;
    private javax.swing.JLabel lblDateModifierEdit;
    private javax.swing.JLabel lblEmpty;
    private javax.swing.JLabel lblName;
    private javax.swing.JLabel lblNotes;
    private javax.swing.JLabel lblStatus;
    private javax.swing.JPanel pnlContainer;
    private javax.swing.JPanel pnlGoods;
    private javax.swing.JPanel pnlList;
    private javax.swing.JRadioButton radioNo;
    private javax.swing.JRadioButton radioYes;
    private javax.swing.JScrollPane scpGoods;
    private javax.swing.JScrollPane scpImportExportList;
    private javax.swing.JScrollPane scpNotes;
    private javax.swing.JSplitPane sppGoods;
    private javax.swing.JTable tblImportExportList;
    private javax.swing.JTree treeGoods;
    private javax.swing.JTextField txtName;
    private javax.swing.JTextPane txtNotes;
    // End of variables declaration//GEN-END:variables
}
